extract-strings: support GMenu GtkBuilder markup
authorRyan Lortie <desrt@desrt.ca>
Wed, 15 Jan 2014 06:35:43 +0000 (01:35 -0500)
committerRyan Lortie <desrt@desrt.ca>
Sat, 18 Jan 2014 03:44:23 +0000 (22:44 -0500)
Add support for extracting strings from GMenu markup in GtkBuilder
files.

This means that we have to support translatable <attribute/> tags.

Unfortunately, <attribute> is also used by GtkTreeViewColumn and
GtkLabel for other purposes, and those other purposes use a value=''
(XML) attribute, so we must accept (and ignore) that in order not to
have errors.  Nothing will happen in those cases because they do not
also specify translatable='yes', so we ignore them.

https://bugzilla.gnome.org/show_bug.cgi?id=720552

gtk/extract-strings.c

index df20d2172ea41bfeaf8c0af131e45a46cb7e42c7..759215367e10dcf1eec47c51864b6063f5ab8937 100644 (file)
@@ -36,6 +36,7 @@ start_element_handler (GMarkupParseContext  *contexts,
   ParserData *data = user_data;
 
   if (g_str_equal (element_name, "property") ||
+      g_str_equal (element_name, "attribute") ||
       g_str_equal (element_name, "item"))
     {
       gboolean translatable;
@@ -47,6 +48,7 @@ start_element_handler (GMarkupParseContext  *contexts,
                                    attribute_values,
                                    error,
                                    G_MARKUP_COLLECT_STRING|G_MARKUP_COLLECT_OPTIONAL, "name", NULL,
+                                   G_MARKUP_COLLECT_STRING|G_MARKUP_COLLECT_OPTIONAL, "value", NULL,
                                    G_MARKUP_COLLECT_TRISTATE, "translatable", &translatable,
                                    G_MARKUP_COLLECT_STRDUP|G_MARKUP_COLLECT_OPTIONAL, "context", &context,
                                    G_MARKUP_COLLECT_STRDUP|G_MARKUP_COLLECT_OPTIONAL, "comments", &comments,